<?php 
    $show_status = C('Common.show_status');
    $groups      = C('APP_GROUP_ARRAY');
?>
<body class="J_scroll_fixed">
<div class="wrap jj">
    <div class="nav">
        <ul class="cc">
            <li><a href="<?php echo U('Admin/Node/index',array('type'=>$result['type'] == 1 ?'admin':'front')); ?>">节点管理</a></li>
            <li class="current"><a href="javascript:;">节点编辑</a></li>
        </ul>
    </div>
    
    <form class="J_ajaxForm" data-role="list" action="<?php echo U('Admin/Node/edit'); ?>" method="post">
    <input type="hidden" name ="id" value="<?php echo $result['id']; ?>">
    <input type="hidden" name ="root_flg" value="<?php echo $result['root_flg']; ?>">
    <input type="hidden" name ="root_id" value="<?php echo $result['root_id']; ?>">
    
    <input type="hidden" name ="_modified_" value="<?php echo $result['modified']; ?>">
    <div class="h_a">节点信息</div>
    <div class="table_full">
      <table width="100%" class="table_form">
        <tr>
          <th width="150">节点名称：</th>
          <td width="300"><input type="text" name="name" id="name" class="input length_3" value="<?php echo $result['name']; ?>"></td>
          <td><div class="fun_tips"></div></td>
        </tr>
        <?php if($result['parent_id']!=0): ?>
        <tr>
          <th>所属节点：</th>
          <td>
            <select name="parent_id" class="select_3">
                <option value="0">作为ROOT节点</option>
                <?php foreach($parent_nodes as $node): ?>
                <option value="<?php echo $node['id'];?>"<?php if($result['parent_id'] == $node['id']) echo ' selected'; ?>><?php echo $node['name'];?></option>
                
                <?php if(!empty($node['left_menu']) && $result['root_flg'] != 1): ?>
                    <?php foreach($node['left_menu'] as $left): ?>
                    <?php if($left['id'] != $result['id']): ?>
                    <option value="<?php echo $left['id'];?>"<?php if($result['parent_id'] == $left['id']) echo ' selected'; ?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|---<?php echo $left['name'];?></option>
                    <?php endif; ?>
                    <?php endforeach; ?>
                <?php endif; ?>
                
                <?php endforeach; ?>
            </select>
          </td>
          <td><div class="fun_tips">更改为ROOT节点后不可变更</div></td>
        </tr>
        <?php else: ?>
        <input type="hidden" name ="parent_id" value="<?php echo $result['parent_id']; ?>">
        <?php endif; ?>
        <tr>
          <th>所属分组：</th>
          <td>
            <select name="g" class="select_2">
                <?php if($result['root_id'] == 0 && $result['parent_id'] == 0): ?>
                <option value=""></option>
                <?php endif; ?>
                <?php foreach($groups as $key=>$val): ?>
                <option value="<?php echo $val;?>"<?php if(isset($result['g']) && $result['g'] == $val) echo ' selected'; ?>><?php echo $val;?></option>
                <?php endforeach; ?>
            </select>
          </td>
          <td><div class="fun_tips"></div></td>
        </tr>
        <tr>
          <th>模块名称：</th>
          <td><input type="text" name="m" id="module" class="input length_3" value="<?php echo $result['m']; ?>"></td>
          <td><div class="fun_tips"></div></td>
        </tr>
        <tr>
          <th>操作名称：</th>
          <td><input type="text" name="a" id="action" class="input length_3" value="<?php echo $result['a']; ?>"></td>
          <td><div class="fun_tips"></div></td>
        </tr>
        <tr>
          <th>额外参数：</th>
          <td><input type="text" name="param" id="param" class="input length_3" value="<?php echo $result['param']; ?>"></td>
          <td><div class="fun_tips">参照(param1=100&amp;param2=abc)</div></td>
        </tr>
        <tr>
          <th>排列顺序：</th>
          <td><input type="text" name="rank" id="rank" class="input length_1" value="<?php echo $result['rank']; ?>"></td>
          <td><div class="fun_tips">整数越小越靠前</div></td>
        </tr>
        <tr>
          <th>显示状态：</th>
          <td>
          <?php foreach($show_status as $key => $val): ?>
              <input type="radio" name="status" value="<?php echo $key; ?>" id="status<?php echo $key; ?>"<?php if($key==$result['status']) echo ' checked'; ?>>
              <label for="status<?php echo $key; ?>"><span><?php echo $val; ?></span></label>
          <?php endforeach; ?>
          </td>
          <td><div class="fun_tips"></div></td>
        </tr>
        <tr>
          <th>备注信息：</th>
          <td><textarea class="length_5" name="remark"><?php echo $result['remark']; ?></textarea></td>
          <td><div class="fun_tips"></div></td>
        </tr>
        </table>
     </div>
     
    <div class="btn_wrap">
       <div class="btn_wrap_pd">
          <button type="submit" class="btn btn_submit mr20 J_ajax_submit_btn" id="J_rights_form_btn">提交</button>
       </div>
    </div>

    </form>
</div>
<script>
Wind.use('region', function(){
    $('a.J_region_change').region();
});
</script>
</body>